package data;

// 新增土壤数据类
public class SoilData {
    private final String location;
    private final double moisture; // 湿度 (%)
    private final double ph;       // pH值
    private final double nitrogen; // 氮含量 (mg/kg)
    private final double phosphorus; // 磷含量 (mg/kg)
    private final double potassium;  // 钾含量 (mg/kg)

    public SoilData(String location, double moisture, double ph,
                    double nitrogen, double phosphorus, double potassium) {
        this.location = location;
        this.moisture = moisture;
        this.ph = ph;
        this.nitrogen = nitrogen;
        this.phosphorus = phosphorus;
        this.potassium = potassium;
    }

    public double getMoisture() {
        return moisture;
    }

    public double getPh() {
        return ph;
    }

    @Override
    public String toString() {
        return String.format("| %-4s | %6.1f   | %4.1f | %6.1f | %6.1f | %6.1f |",
                location, moisture, ph, nitrogen, phosphorus, potassium);
    }
}
